[PATCH 1/2] Create: check for UnSet when looking at chunk

From ceb5a3431f27b5030d964567dedb0f983862b347 Mon Sep 17 00:00:00 2001
From: Anna Czarnowska <anna.czarnowska [at] intel.com>
Date: Wed, 30 Mar 2011 13:21:21 +0200
Subject: [PATCH 1/2] Create: check for UnSet when looking at chunk
Cc: linux-raid [at] vger.kernel.org, Williams, Dan J <dan.j.williams [at] intel.com>, Ciechanowski, Ed <ed.ciechanowski [at] intel.com>

A default chunk size of 0 gets modified to UnSet, so any location that
checks for !chunk really needs to check for !(chunk || chunk == UnSet).

Signed-off-by: Dan Williams <dan.j.williams [at] intel.com>
Signed-off-by: Anna Czarnowska <anna.czarnowska [at] intel.com>
---
Create.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Create.c b/Create.c
index 9f34425..5709baf 100644
--- a/Create.c
+++ b/Create.c
[at] [at] -266,7 +266,7 [at] [at] int Create(struct supertype *st, char *mddev,
&chunk, size*2, NULL, &newsize, verbose>=0))
return 1;

- if (chunk) {
+ if (chunk && chunk != UnSet) {
newsize &= ~(unsigned long long)(chunk*2 - 1);
size &= ~(unsigned long long)(chunk - 1);
}
[at] [at] -353,7 +353,7 [at] [at] int Create(struct supertype *st, char *mddev,
}

freesize /= 2; /* convert to K */
- if (chunk) {
+ if (chunk && chunk != UnSet) {
/* round to chunk size */
freesize = freesize & ~(chunk-1);
}
--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
anna.czarnowska [ Mi, 30 März 2011 13:28 ] [ ID #2057275 ]

Re: [PATCH 1/2] Create: check for UnSet when looking at chunk

On Wed, 30 Mar 2011 12:28:11 +0100 "Czarnowska, Anna"
<anna.czarnowska [at] intel.com> wrote:

> >From ceb5a3431f27b5030d964567dedb0f983862b347 Mon Sep 17 00:00:00 2001
> From: Anna Czarnowska <anna.czarnowska [at] intel.com>
> Date: Wed, 30 Mar 2011 13:21:21 +0200
> Subject: [PATCH 1/2] Create: check for UnSet when looking at chunk
> Cc: linux-raid [at] vger.kernel.org, Williams, Dan J <dan.j.williams [at] intel.com>, Ciechanowski, Ed <ed.ciechanowski [at] intel.com>
>
> A default chunk size of 0 gets modified to UnSet, so any location that
> checks for !chunk really needs to check for !(chunk || chunk == UnSet).
>
> Signed-off-by: Dan Williams <dan.j.williams [at] intel.com>
> Signed-off-by: Anna Czarnowska <anna.czarnowska [at] intel.com>

This and the next one both applied - thanks.

NeilBrown


> ---
> Create.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Create.c b/Create.c
> index 9f34425..5709baf 100644
> --- a/Create.c
> +++ b/Create.c
> [at] [at] -266,7 +266,7 [at] [at] int Create(struct supertype *st, char *mddev,
> &chunk, size*2, NULL, &newsize, verbose>=0))
> return 1;
>
> - if (chunk) {
> + if (chunk && chunk != UnSet) {
> newsize &= ~(unsigned long long)(chunk*2 - 1);
> size &= ~(unsigned long long)(chunk - 1);
> }
> [at] [at] -353,7 +353,7 [at] [at] int Create(struct supertype *st, char *mddev,
> }
>
> freesize /= 2; /* convert to K */
> - if (chunk) {
> + if (chunk && chunk != UnSet) {
> /* round to chunk size */
> freesize = freesize & ~(chunk-1);
> }

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo [at] vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
NeilBrown [ Di, 05 April 2011 01:32 ] [ ID #2057597 ]
Linux » gmane.linux.raid » [PATCH 1/2] Create: check for UnSet when looking at chunk

Vorheriges Thema: [PATCH 1/3] imsm: Warn user about reboot risk
Nächstes Thema: [PATCH] FIX: After discarding array give chance monitor to remove it